From b08daf886cf4c128eead4becbdab8041750f4c3a Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Wed, 21 Jan 2026 12:20:05 +0300 Subject: [PATCH] inline openat2 syscall Forwarded: not-needed openat2() is not provided by glibc, so is implemented in samba's libreplace. By inlining the implementation, we avoid additional linkage to libreplace. Not forwarding since proper fix needs proper clean-up of the #ifdef'fery. Gbp-Pq: Name inline-openat2.diff --- lib/replace/system/filesys.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/replace/system/filesys.h b/lib/replace/system/filesys.h index 9738ad52..130ad4b5 100644 --- a/lib/replace/system/filesys.h +++ b/lib/replace/system/filesys.h @@ -272,10 +272,16 @@ struct __rep_open_how { #endif /* ! HAVE_LINUX_OPENAT2_H */ #ifndef HAVE_OPENAT2 -long rep_openat2(int dirfd, const char *pathname, - struct open_how *how, size_t size); -#define openat2(dirfd, pathname, how, size) \ - rep_openat2(dirfd, pathname, how, size) +#define HAVE_OPENAT2 +#ifdef __linux__ +#include +static inline long openat2(int dirfd, const char *pathname, + struct open_how *how, size_t size) { + return syscall(SYS_openat2, dirfd, pathname, how, size); +} +#else +#define openat2(dirfd, path, how, size) (errno = -ENOSYS, -1) +#endif #endif /* !HAVE_OPENAT2 */ #ifdef DISABLE_OPATH -- 2.30.2